package com.lrf.freeshipping.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;

import com.lrf.freeshipping.service.TimeManager;

public class DateTaskListener implements ServletRequestListener {
	
    private TimeManager manager;

	@Override
	public void requestDestroyed(ServletRequestEvent sre) {
	}

	@Override
	public void requestInitialized(ServletRequestEvent sre) {
	    if(manager==null){
           ServletContext context = sre.getServletContext();
	       manager = (TimeManager) context.getAttribute("TimeManager");
	    }
	    if(manager.isStop())
	       manager.start();
	}
	
   
}
